<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Choose dishes_{$webname}</title>
<meta name="keywords"    content="{$keywords}">
<meta name="description" content="{$description}">
<!--公共样式开始-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/reset.css" />
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/common.css" />
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/FontAwesome/css/font-awesome.min.css" />
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/FontAwesome/css/font-awesome-ie7.min.css">
<![endif]-->
<!--公共样式结束-->
<!--页面样式开始-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/page_dishes.css" />
<!--页面样式结束-->
<script type="text/javascript" src="{$NOW_THEME_URL}/Assets/Js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="{$NOW_THEME_URL}/Assets/Js/jquery.SuperSlide.2.1.1.js"></script>
<script type="text/javascript" src="{$NOW_THEME_URL}/Assets/Js/jquery.nicescroll.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/jquery.timers.js"></script>
<style>
.tanchuprice{
	font-size:24px;
	color:#FE6700;
}
</style>
</head>

<body>
<div class="zhezhao"></div>
<div class="temp"></div>
<div class="rst-header-map rst-h-a-cnt maphide">
	<!-- <include file="Dishes:ditu" lang="true"/> -->
</div>
<div class="zz">
	<!--top start-->
	<include file="Public:header" lang="true" />
	<!--top end-->
	<div class="content_top">
		<div class="ct_main clearfix">
			<div class="ctm_left">
				<dl class="clearfix">
					<dt><img src="{$NOW_THEME_URL}/Assets/Images/ctname1.jpg"/></dt>
					<dd class="name">{$detail.entitle|stripcslashes=###}</dd>
					<dd class="score">
					<a>
						<div class="starbg" style="width:{$detail['level']*20}%;" ></div>
						<div class="star"></div>
					</a>
						<span class="color_main">{$detail.level}</span>
					</dd>
				</dl>
				<!---->
				<div class="rst-header-detail rst-header-dropdown yytime">
					<p>Opening Hours：{$detail.starthours}-{$detail.endhours}&nbsp;&nbsp;
					<notempty name="detail.starthours1">{$detail.starthours1}-{$detail.endhours1}</notempty></p>
					<p>{$detail.enaddress}</p>
					<p>{$detail.encontent}</p>
				</div>
			</div>
			<div class="ctm_right">
				<ul class="ctmul clearfix">
					<li>
						<h1>{$detail.time}</h1>
						<h2>time(min)</h2>
					</li>
					<li class="map">
						<h1 id="juli1">649</h1>
						<h2>distance(km)</h2>
						<!--  <h2>Restaurant Distance / m</h2>-->
						<h3><i class="icon-caret-down"></i></h3>
						<div class="rst-header-dropdown ditu ">
							
						</div>
					</li>
					<li>
						<h1 class="psf">{$detail.sever}</h1>
						<eq name="detail.exempt" value="2">
							<h2>（-￥{$detail.exemptprice}）</h2>
						<else />
							<h2>delivery fee/rmb</h2>
						</eq>
						<h3><i class="icon-caret-down"></i></h3>
						<div class="rst-header-dropdown lucheng">
							<div class="rst-deliver rst-h-a-cnt">
								<h4>Additional description:</h4>
								<p>{$detail.enservice}</p>
							</div>
						</div>
					</li>
				</ul>
			</div>
		</div>
	</div>
	<!--content start-->
	<div class="content mapico1">
	
		<div class="buzou clearfix">
			<div class="buzou_left clearfix">
				<dl>
					<dt>1.Select a location</dt>
					<dd><a href="{:U('Index/address')}"></a></dd>
				</dl>
				<dl>
					<dt>2.Restaurant</dt>
					<dd><a href="{:U('Restaurant/index')}"></a></dd>
				</dl>
				<dl class="hover">
					<dt>3.Choose dishes</dt>
					<dd><a href="{:U('Dishes/index')}"></a></dd>
				</dl>
				<dl>
					<dt>4.Confirm Order</dt>
					<dd></dd>
				</dl>
				<dl>
					<dt>5.Complete order</dt>
					<dd></dd>
				</dl>
			</div>
			<div class="buzou_right">
				<a href="http://vipwebchat.tq.cn/pageinfo.jsp?version=vip&admiuin=9632675&ltype=100&iscallback=0&page_templete_id=79615&is_message_sms=0&is_send_mail=0&action=acd&acd=1&type_code=1" target=_blank><img src="http://float2006.tq.cn/staticimg.jsp?version=vip&admiuin=9632675&ltype=100&action=acd&acd=1&type_code=1&onlinepic=http://userfiles.tq.cn/userfiles/upload_163/9632675/1411565972.png&offlinepic=http://userfiles.tq.cn/userfiles/upload_163/9632675/1411628431.png" border='0' /></a>
			</div>
		</div>
		<div class="jianjie">
			<dl class="clearfix">
				<dt>
					<php>if($cjthumb['fileurl']){</php>
						<div class="bg_main"><img src="{$Think.UPLOAD_PATH}{$cjthumb.fileurl}" /></div>
					<php>}else{</php>
						<img src="{$NOW_THEME_URL}/Assets/Images/logos.png" />
					<php>}</php>
				</dt>
				<dd>
					<h1 class="color_main">{$detail.entitle|stripcslashes=###}
						
					</h1>
				</dd>
				<dd class="free_ps">
					<h2>
						<eq name="detail.exempt" value="2">
							<!--<img src="{$NOW_THEME_URL}/Assets/Images/mian.png"/>-->
							（{$detail.exemptprice} RMB OFF：{$detail.exemptbegin} ~ {$detail.exemptend}）
						<else />
							&nbsp;
						</eq>
					</h2>
				</dd>
				<dd><h3>Opening Hours：{$detail.starthours}-{$detail.endhours}&nbsp;&nbsp;
				<notempty name="detail.starthours1">{$detail.starthours1}-{$detail.endhours1}</notempty></h3></dd>
				<dd><h4 style="width:640px">{$detail.enaddress}</h4></dd>
				<dd><h5>{$detail.encontent}</h5></dd>
				<notempty name='notice[0]'>
					<dd class="jjhide">
	                    <h3 class="notice">Notice</h3>
						<ul class="ctmul ct1 clearfix">
								<volist name='notice' id='v'>
									<li>{$v}</li>
		                        </volist>
						</ul>
					</dd>
				</notempty>
			</dl>
		</div>
		
		<div class="dishes clearfix">
			
			<!--search开始-->
			<!--<div class="search clearfix">
				<div class="search_ico">
					<img src="{$NOW_THEME_URL}/Assets/Images/search_ico.jpg" />
				</div>
				<div class="search_text">
					<form action="" method="get" class="clearfix">
						<input class="st2 width_400" name="" type="text" />
						<input class="st3 width_100" name="" type="button" value="Search" />
					</form>
				</div>
			</div>-->
			<!--search结束-->
			<div class="clearfix">
				<!--rest_left start-->
				<div class="dishes_left">
					<notempty name='sort'>
						<!--dleft1 start-->
						<div class="dleft1">
							<!--dishes_title start-->
							<div class="dishes_title color_main">Food Category</div>
							<!--dishes_title end-->
							<!--dishes_content start-->
							<div class="dishes_content">
								<ul class="fenlei clearfix">
									<volist name="sort" id="v">
										<li><a href="#dishes{$key}" class="color_main">{$v['sort']['entitle']}（{$v['count']}）</a></li>
									</volist>
								</ul>
							</div>
							<!--dishes_content end-->
						</div>
						<!--dleft1 end-->
					</notempty>
					
					<notempty name='sort'>
						<!--top10 start-->
						<include file="Dishes:topTen" lang="true" />
						<!--top10 end-->
					</notempty>
					
					<!--dleft2 start-->
					<volist name="dishSort" id="vo">
					<div class="dleft2" name="dishes{$key}">
					<a name="dishes{$key}"></a>
						<!--dishes_title start-->
						<div class="dishes_title color_main">
							<i class=" icon-caret-down"></i> {$vo['sort']['sort']['entitle']}
						</div>
						<!--dishes_title end-->
						<!--dishes_content start-->
						<div class="dishes_content">
							<div class="cd clearfix">
								<volist name="vo['dish']" id="d" >
									<eq name="mod" value="0" >
										<dl class=" clearfix even " price="{$d.sprice}" tprice="{$d.tprice}" num="{$d.num}" disheid="{$d.id}" sortflag="dishes" >
											<dt>
												<em class="<notempty name='d.enabstract'>dishesname<else />dishesnames</notempty> color_main">
													<span class="dishesname1" title="{$d.entitle|stripcslashes=###}">{$d.entitle|stripcslashes=###}</span>
												</em>
												<p>{$d.enabstract}</p>
											</dt>
											<empty name="d.gnfr" >
												<dd class="fujia" rel="no"></dd>
											<else />
												<dd class="fujia" rel="have">
													<i class="icon-plus-sign-alt color_main"></i>
												</dd>
											</empty>
											<dd class="price">￥{$d.sprice}</dd>
											
											<php>if(find_resource($d['solevar'],'thumb')!=""){</php>
												<dd class="dc_hide clearfix">
													<img src="{$Think.UPLOAD_PATH}{$d.solevar|find_resource=###,'thumb'}" />
													<!--<span>{$d.enabstract}</span>-->
												</dd>
											<php>}</php>
										</dl>
									<else />
										<dl class="clearfix" price="{$d.sprice}" tprice="{$d.tprice}" num="{$d.num}" disheid="{$d.id}" sortflag="dishes"	 >
											<dt>
												<em class="color_main <notempty name='d.enabstract'>dishesname<else />dishesnames</notempty>">
													<span class="dishesname1" title="{$d.entitle|stripcslashes=###}">{$d.entitle|stripcslashes=###}</span>
												</em>
												<p>{$d.enabstract}</p>
											</dt>
											<empty name="d.gnfr" >
												<dd class="fujia" rel="no" ></dd>
											<else />
												<dd class="fujia" rel="have">
													<i class="icon-plus-sign-alt color_main"></i>
												</dd>
											</empty>
											<dd class="price">￥{$d.sprice}</dd>
											<php>if(find_resource($d['solevar'],'thumb')!=""){</php>
												<dd class="dc_hide clearfix">
														<img src="{$Think.UPLOAD_PATH}{$d.solevar|find_resource=###,'thumb'}" />
													<!--<span>{$d.enabstract}</span>-->
												</dd>
											<php>}</php>
											
										</dl>
									</eq>
								</volist>
							</div>
						</div>
						<!--dishes_content end-->
					</div>
					</volist>
					<!--dleft2 end-->
					<div class="beer">The Wine,Beverages,Ice & Cigaratte From KK.Rabbit.</div>
					<!--dleft2 start-->
					
					<div class="dleft2" name="dishes2">
					<!-- dishes_title start     -->
					<!-- <a name="dishes4"></a> -->
					<volist name="drinkSort" id="vo"> 
						<div class="dishes_title color_main">
							<i class=" icon-caret-down"></i> {$vo['title']['en-us']}（<php>echo count($vo['list']);</php>） 
						</div>
						<!--dishes_title end-->
						<!--dishes_content start-->
						<div class="dishes_content">
							<div class="cd beercd clearfix">
								<volist name="vo.list" id="k" >
									<eq name="mod" value="0" >
										<dl class="dc1 clearfix even" price="{$k.sprice}" tprice="{$k.tprice}" disheid="{$k.id}" sortflag="drink" num="{$k.num}">
											<dt>
												<em class="<notempty name='k.content'>dishesname<else />dishesnames</notempty> color_main">
													<span class="dishesname1" title="{$k.entitle|stripcslashes=###}">{$k.entitle|stripcslashes=###}</span>
												</em>
												<p>{$k.encontent}</p>
											</dt>
											<dd class="fujia" rel="no">
												<i class=""></i>
											</dd>
											<php>if($d['tprice']=='0.00' || $d['tprice']==''){</php>
												<dd class="price">￥{$k.sprice}</dd>
											<php>}else{</php>
												<dd class="price">￥<span id="yprice">{$k.sprice}</span><span class="tprice">￥{$k.tprice}</span></dd>
											<php>}</php>
											<php>if(find_resource($k['solevar'],'thumb')!=""){</php>
												<dd class="dc_hide clearfix">
													<img src="{$Think.UPLOAD_PATH}{$k.solevar|find_resource=###,'thumb'}" />
													<!--<span>{$d.abstract}</span>-->
												</dd>
											<php>}</php>
										</dl>
									<else />
										<dl class="dc1 clearfix " price="{$k.sprice}" tprice="{$d.kprice}" disheid="{$k.id}" num="{$k.num}">
											<dt>
												<em class="<notempty name='k.content'>dishesname<else />dishesnames</notempty> color_main">
													<span class="dishesname1" title="{$k.entitle|stripcslashes=###}">{$k.entitle|stripcslashes=###}</span>
												</em>
												<p>{$k.encontent}</p>
											</dt>
											<dd class="fujia" rel="no">
												<i class=""></i>
											</dd>
											<php>if($d['tprice']=='0.00' || $d['tprice']==''){</php>
												<dd class="price">￥{$k.sprice}</dd>
											<php>}else{</php>
												<dd class="price">￥<span id="yprice">{$k.sprice}</span><span class="tprice">￥{$k.tprice}</span></dd>
											<php>}</php>
											<php>if(find_resource($k['solevar'],'thumb')!=""){</php>
												<dd class="dc_hide clearfix">
													<img src="{$Think.UPLOAD_PATH}{$k.solevar|find_resource=###,'thumb'}" />
													<!--<span>{$d.abstract}</span>-->
												</dd>
											<php>}</php>
										</dl>
									</eq>
								</volist>
							</div>
						</div>
					</volist>
						<!--dishes_content end-->
						
					</div>
					<!--dleft2 end-->
				</div>
				<!--rest_left end-->
				<!--rest_right start-->
				<div class="dishes_right">
					<!--dr1 start-->
					<div class="dr1">
						<!-- <div class="dr11">
							<i class="icon-volume-up"></i>Deals: latest deals Overall 20%
						</div> -->
						<div class="dr13">
							<!--<a class="sc collect" style="cursor:pointer"><i class="icon-heart-empty icon-2x"></i><em>Favorite</em></a> -->
							<a class="ly" style="cursor:pointer"><i class="icon-edit icon-2x"></i><em>Message</em></a>
						</div>
					</div>
					<!--dr1 end-->
				</div>
				<!--rest_right end-->
			</div>
		</div>
	</div>
	<!--content end-->
	
	<!--footer start-->
	<include file="Public:footer" lang="true" />
	<!--footer end-->
	<div class="shopico">
		<i class=" icon-shopping-cart icon-2x"></i>
	</div>
	<!-- cart start -->
	<div class="shopcar">
		<div class="sp_content">
			<ul class="spc_ul" style="height:300px;overflow:hidden;overflow:auto">
				<!-- <li>购物车中还有4件商品未显示</li> -->
			</ul>
		</div>
		<div class="sp_title clearfix">
			<!--<h1 class="sp_s1"><i class=" icon-shopping-cart icon-2x"></i></h1>-->
			<div class="zongji">
				<h2 class="clearfix">Food Fee：<span>￥<em class="foodfee">0</em></span></h2>
				<h2 class="clearfix">Delivery Fee：<span>￥<em class="dliveryfee">
					<eq name="detail.sever" value="">0<else/>{$detail.sever}</eq></em></span>
				</h2>
				<h3 class="clearfix">Total：<span>￥<em class="totalprice">0</em></span></h3>
				<h4 class="clearfix"><span class="shophide"><i class="icon-chevron-right"></i></span>
					<a class="quxiadan confirm_orders">Submit</a></h4>
			</div>
		</div>
	</div>
	<!-- cart end -->
</div>
<div class="fj" id="maskWindow" ></div>
<div class="liuyan_ck">
	<include file="Dishes:message" lang="true" />
</div>
<div class="cityck selectcity">
		<h1>You haven't select the correct address, click the button to choose the address</h1>
		<h3><a href="{:U('Index/index')}" class="ck">To choose the city</a></h3>
	</div>
<script type="text/javascript">
	
	<notempty name="noneCity">
		$('.selectcity').show();
		$('.zhezhao').show();
	</notempty>
	
	var outletid  = "{$Think.get.id}";   //餐厅id
	$('body').on('mouseenter','.shopcar .spc_ul>li',function(){
		var html     = $(this).find('.caipin').html();
		//console.log(html);
		if(html ==null || html==undefined || html=='undefined' || html==''){
			$('.temp').html('');
			$('.temp').hide();
			return false;
		}else{
			var position = $(this).offset();
			$('.temp').html(html);
			$('.temp').css({'left':position.left-242,'top':position.top});
			$('.temp').show(); 
		}		
	});

	$('body').on('mouseleave','.shopcar .spc_ul>li',function(){
		$('.temp').hide(); 
	});

	//返回顶部
	$(window).on('scroll',function(){
		var scrollTop = $(document).scrollTop();
	});
	//点击购物图标显示购物筐
	$('.shopico').on('click',function(){
		showcart();
	});
	//点击箭头隐藏购物筐
	$('.shophide').on('click',function(){
		hidecart();
	});
	
	$('.collect').on('click',function(){
		var oid = "{$detail.id}";
		$.get("{:U('Public/member_collect')}",{oid:oid},function(data){
			alert(data.info);
		});
	})
	
	//点击关闭留言弹出窗口
	$(".btn_cancel").on("click",function(){
		$('.liuyan_ck').hide();
		cancelshade();
	});
	
	$(".btn_login").on('click',function(){
		
		var email   = $("#email").val();
		var mobile  = $("#mobile").val();
		var message = $("#message").val();
		
		if(mobile==""){
			alert("Telephone number cannot be empty");return false;
		}
		
		if(email==""){
			alert("Email cannot be empty");return false;
		}
		
		if(message==""){
			alert("Message content cannot be empty");return false;
		}else{
			var postData = {};
			postData = $(".formMessage").serialize();
			$.post("{:U('Public/message')}",postData,function(d){
				alert(d.info);
				cancelshade(); //取消遮罩
				$('.liuyan_ck').hide();
			});
		}
	});
	
	$(function(){
		
		//菜品说明加滚动条
		$(".dishes_content").find('p').niceScroll({cursorcolor:"#fe6700"});
		//购物车加滚动条
		$(".spc_ul").niceScroll({cursorcolor:"#fe6700"});
		
		//点击某一菜品往购物车添加菜品
		$('.cd dl').on('click',function(){
			
			var dishesid  = $(this).attr("disheid");    //菜品id
			var sprice    = $(this).attr("price");      //菜品价格
			var tprice    = $(this).attr("tprice");     //菜品特价
			var sortflag  = $(this).attr("sortflag");   //dishes或者drink
			var dishesnum = parseInt($(this).attr("num"));
			var fjrel     = $(this).find('.fujia').attr('rel');
			var price     = 0;
			var isspec    = 2;   //定义特价标志位，1特价|2普通价格
			var outletid  = "{$Think.get.id}";   //餐厅id
			
			price  = tprice==0? sprice  : tprice;  //判断菜品特价是否存在，如果有菜品特价则使用菜品特价，没有则使用销售价格
			isspec = tprice==0? isspec  : 1;  
			
			//判断是否是菜品
			if(sortflag=="dishes"){
				if(dishesnum>0){
					if(fjrel=='no'){
						cartList(setprop(dishesid,isspec,price,"dishes",outletid));  //设置prop属性的值，调用购物车的添加方法
					}else{
						gettanchu(dishesid,outletid); //调用属性窗口弹出方法			            
					}
				}else{
					alert("I'm sorry the items were bought!");
				}
			//否则为酒水
			}else{
				if(dishesnum>0){
					cartList(setprop(dishesid,isspec,sprice,"drink",outletid));    //设置prop属性的值，调用购物车的添加方法
				}else{
					alert("I'm very sorry, the wine has been sold out");
				}
			}
		});
		
		//点击addtocart按钮将菜品菜品属性添加到购物车
		$('.scbtn').live('click',function(){
			var postData    = {};
			postData        = $("#dishpert").serialize();
			cartList(postData);
		});
		
		//减少商品数量
		$('.minus').live("click",function(){
			var obj    = $(this).siblings('li.num');
			var price  = $(this).attr("rel");      //菜品价格
			var num    = parseInt(obj.html());
			var id     = $(this).attr("id");
			if(num==1){
				return false;
			}else{
				num -= 1;
				obj.html(num);
				price = price*num ;
				price = price.toFixed(2);
				$(this).parent('.count').parent('.number').siblings('.price').children('em').html(price);
				setnum(id,price,num); //调用修改购物车中菜品的数量方法
				changetotal(); //计算总价
			}
			
		});
		//增加商品数量
		$('.plus').live("click",function(){
			var obj     = $(this).siblings('li.num');
			var price   = $(this).attr("rel");      //菜品价格
			var num     = parseInt(obj.html());
			var id      = $(this).attr("id");
			if(num>=20){
				return false;
			}else{
				num += 1;
				obj.html(num);
				price = price*num ;
				price = price.toFixed(2);
				$(this).parent('.count').parent('.number').siblings('.price').children('em').html(price);				
				setnum(id,price,num); //调用修改购物车中菜品的数量方法
				changetotal(); //计算总价
			}
		});
		
		//删除购物车中的一件商品
		$('.remove').live('click',function(){
			$(this).parent('li').remove();	
			var id = $(this).attr("rel");
			delone(id);
			changetotal();
		});
		
		//取消遮罩
		$('.qxbtn').live('click',function(){
			cancelshade();
		});
		
		//顶部显示隐藏
		/*$(window).scroll(function(){
			if($(window).scrollTop() >= 110){
				$('.content_top').show();
				$('.jianjie dl').hide();
				$('.content .buzou').css('margin-top','180px');
			}
			else{
				$('.content_top').hide();
				$('.jianjie dl').show();
				$('.content .buzou').css('margin-top','20px');
			}
		});*/ 
		
		$('.kx').on('click',function(){
			$(this).prev().prev('input').prop("checked", false);
			
		});
		
		//餐厅提示
		$('.cd dl').on('hover', function(){
			$(this).children('.dc_hide').toggle();
		});
		
		$('.ctm_left').on('hover', function(){
			$(this).children('.rst-header-detail').toggle();
		});
		
		$('.ctmul li').on('hover', function(){
			$(this).children('.rst-header-dropdown').toggle();
		});
		
		var top = $('.mapico1').offset().top;
		var left = $('.mapico1').offset().left;
		//alert(left);
		//var top2 = $('.mapico2').offset().top;
		//var left2 = $('.mapico2').offset().left;
		
		$('.map').on('hover', function(){
			$('.maphide').addClass('dobble_ditu');
			$('.dobble_ditu').css({top:100 , left:left+650});
			$('.maphide').show();
		});
		$('.map').on('mouseleave', function(){
			$('.maphide').removeClass('dobble_ditu');
			
			$('body').oneTime('1s','mapTime',function(){
				$('.maphide').hide();
			});			
		});
		$('.maphide').on('mouseenter', function(){
			$('body').stopTime('mapTime');		
		});
		$('.maphide').on('mouseleave', function(){
			$('.maphide').hide();		
		});
		
		$('.map2').on('hover', function(){
			$('.maphide').addClass('dobble_ditu');
			$('.dobble_ditu').css({top:top2+20 , left:left2-210});
			$('.maphide').show();
		});
		$('.map2').on('mouseleave', function(){
			$('.maphide').removeClass('dobble_ditu');
			
			$('body').oneTime('1s','mapTime',function(){
				$('.maphide').hide();
			});			
		});
		
		//悬浮框显示隐藏
		$('.online').on('hover',function(){
			$('.online ul').toggle();
		});
		var value= location.href.split("=")[1];
	    //alert(value);
		$('.addr').html(decodeURI(value));
	});
	
	$('.zhezhao').height($('.zz').height());
	//显示弹出窗口
	function showbezel(){
		$('.fj').show();	
		$('.zhezhao').show();
	}
	//取消遮罩
	function cancelshade(){
		$('.fj').hide();	
		$('.zhezhao').hide();
	}
	//显示购物车列表	
	function showcart(){
		$('.shopcar').slideDown();
		$('.shopico').hide();
		cartview();	
	}
	//隐藏购物车列表
	function hidecart(){
		$('.shopcar').slideUp();
		$('.shopico').show();
	}
	//定义prop属性返回prop对象
	function setprop(dishesid,isspec,price,model,outletid){
		
		var prop     = {};
		prop.id      = dishesid;
		prop.model   = model;
		prop.isspec  = isspec;
		prop.price   = price;
		prop.solevar = "{:create_id()}";
		prop.flag    = false;
		prop.isprop  = "noprop";
		prop.outletid= outletid;
		
		return prop;
	}
	
	
	//计算价格
	function changetotal(){
		
		var total      = 0;   //商品总价含运送费	
		var foodfee    = 0;   //商品总价格不含运送费
		var dliveryfee = $(".dliveryfee").html();  //运送费
		if(dliveryfee==""||dliveryfee==null){
			dliveryfee = 0;
		}
		$.get("{:U('Dishes/calculateTotal')}",{outletid:outletid},function(d){

			if(d.status==1){
				foodfee = parseFloat(d.data);
				total   = foodfee + parseInt(dliveryfee);
				total   = total?total.toFixed(2):0.00;
				foodfee = foodfee?foodfee.toFixed(2):0.00;
				
				$(".foodfee").html(foodfee)
				$(".totalprice").html(total);
			}
			setBtn(total);
		});
	}
	
	//设置按钮状态
	function setBtn(total){ 
		if(total){
			var url = "{:U('Order/confirm','id='.$detail['id'])}";
			$('.quxiadan').addClass('confirm_order');
			$('.quxiadan').removeClass('confirm_orders');
			$('.quxiadan').attr("href",url);
		}else{
			$('.quxiadan').addClass('confirm_orders');
			$('.quxiadan').removeClass('confirm_order');
			$('.quxiadan').removeAttr("href");
		}
	}
	
	//异步获取弹出菜品属性窗口页面
	function gettanchu(dishesid,outletid){
		$.get("{:U('Dishes/tanchu')}",{dishesid:dishesid,outletid:outletid},function(html){
			$('.fj').html(html);
			showbezel();     //显示弹出窗口
			formLayout();    //调用赋值弹出窗口高度
		});
	}
	
	//修改购物车中菜品的数量
	function setnum(id,price,num){
		var postData    = {};
		postData.id     = id;
		postData.num    = num;
		postData.price  = price;
		$.post("{:U('Dishes/setnum')}",postData);
	}
	//异步删除购物车中的商品
	function delone(id){
		$.get("{:U('Dishes/delone')}",{id:id,outletid:outletid},function(html){
			$('.spc_ul').html(html);
			changetotal(); //计算总价
		});
	}
	//查询当前用户购物车列表
	function cartview(){
		$.get("{:U('Dishes/cartview')}",{outletid:outletid},function(html){
			$('.spc_ul').html(html);
			changetotal(); //计算总价
		});
	}
	//异步插入购物车并返回购物车列表
	function cartList(postData){
		$.post("{:U('Dishes/cartList')}",postData,function(html){
			$('.spc_ul').html(html);  //加载购物车列表
			$('.dliveryfee').html($('.psf').html());  //设置外送费
			changetotal(); //计算总价
		});
		cancelshade(); //取消遮罩
		$('.shopcar').slideDown();
		$('.shopico').hide();
	}
	
	//弹出留言窗口
	$('.ly').on('click',function(){
		$('.liuyan_ck').show();
		$('.zhezhao').show();
	});
	$('.btn_login').on('click',function(){
		$('.liuyan_ck').hide();
		$('.zhezhao').hide();
	});
	
	$(window).on('resize',function(){
		formLayout();
	});
	formLayout();
	function formLayout(){
		var ly_left = ($(window).width()-440)/2;
		$('.liuyan_ck').css('left',ly_left);
		
		var fj_height = $('.fj h4').height() + $('.fj form').height();
		$('.fj').height(fj_height);
	}
</script>
</body>
</html>
